import java.sql.*;

public class Select {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {


        Class.forName("com.mysql.cj.jdbc.Driver");//加载JDBC
        String url = "jdbc:mysql://localhost:3306/people_data?serverTimezone=GMT%2B8";
        String username = "lx";
        String password = "lx061900..";

        Connection connection = DriverManager.getConnection(url, username, password);

        Statement statement = connection.createStatement();


        String sql = "SELECT userid FROM people";
        ResultSet resultSet = statement.executeQuery(sql);
        while (resultSet.next()) {
            System.out.println("userid:" + resultSet.getObject("userid"));
            System.out.println("*******************************************");

        }
        statement.close();
        connection.close();
        resultSet.close();

    }
}
